package ace.module.oauth2.server.core.impl.dao.entity;

import jakarta.annotation.Nullable;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.experimental.SuperBuilder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.annotation.Version;
import org.springframework.data.relational.core.mapping.Table;
import jakarta.validation.constraints.Size;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotEmpty;
import java.io.Serializable;
import ace.cmp.spring.data.jdbc.querydsl.core.annotations.LogicDelete;
import ace.cmp.spring.graphql.core.model.GenericPageContent;
import ace.module.oauth2.server.api.model.dto.Oauth2RegisteredClientAuthConfigDto;

/**
* oauth2客户端支持的认证与授权协议配置,支持本地bean与rest方式.
*
* @author Caspar
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(title = Oauth2RegisteredClientAuthConfigDto.TABLE_DESC)
@Table(Oauth2RegisteredClientAuthConfigDto.TABLE_NAME)
public class Oauth2RegisteredClientAuthConfig implements Serializable, GenericPageContent<Long> {

  @Id
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.ID_TITLE, description = Oauth2RegisteredClientAuthConfigDto.ID_DESC)
  private Long id;

  @Size(max = 255)
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.ID_OF_CLIENT_TITLE, description = Oauth2RegisteredClientAuthConfigDto.ID_OF_CLIENT_DESC)
  private String idOfClient;

  /**
   * {@link ace.module.oauth2.server.api.enums.Oauth2RegisteredClientAuthConfigBizAuthTypeEnum}
   */
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.BIZ_AUTH_TYPE_TITLE, description = Oauth2RegisteredClientAuthConfigDto.BIZ_AUTH_TYPE_DESC)
  private Integer bizAuthType;

  /**
   * {@link ace.module.oauth2.server.api.enums.Oauth2RegisteredClientAuthConfigApiImplTypeEnum}
   */
  @Size(max = 255)
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.API_IMPL_TYPE_TITLE, description = Oauth2RegisteredClientAuthConfigDto.API_IMPL_TYPE_DESC)
  private String apiImplType;

  @Size(max = 255)
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.BEAN_NAME_TITLE, description = Oauth2RegisteredClientAuthConfigDto.BEAN_NAME_DESC)
  private String beanName;

  /**
   * {@link ace.module.oauth2.server.api.enums.Oauth2RegisteredClientAuthConfigAuthenticationTypeEnum}
   */
  @Size(max = 255)
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.AUTHENTICATION_TYPE_TITLE, description = Oauth2RegisteredClientAuthConfigDto.AUTHENTICATION_TYPE_DESC)
  private String authenticationType;

  @Size(max = 255)
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.FEIGN_NAME_TITLE, description = Oauth2RegisteredClientAuthConfigDto.FEIGN_NAME_DESC)
  private String feignName;

  /**
   * {@link ace.module.oauth2.server.api.enums.Oauth2RegisteredClientAuthConfigFeignRequestInterceptorStatusEnum}
   */
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.FEIGN_REQUEST_INTERCEPTOR_STATUS_TITLE, description = Oauth2RegisteredClientAuthConfigDto.FEIGN_REQUEST_INTERCEPTOR_STATUS_DESC)
  private Integer feignRequestInterceptorStatus;

  @Schema(title = Oauth2RegisteredClientAuthConfigDto.CALLBACK_URL_TITLE, description = Oauth2RegisteredClientAuthConfigDto.CALLBACK_URL_DESC)
  private String callbackUrl;

  @Schema(title = Oauth2RegisteredClientAuthConfigDto.PRIORITY_TITLE, description = Oauth2RegisteredClientAuthConfigDto.PRIORITY_DESC)
  private Long priority;

  /**
   * {@link ace.module.oauth2.server.api.enums.Oauth2RegisteredClientAuthConfigStatusEnum}
   */
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.STATUS_TITLE, description = Oauth2RegisteredClientAuthConfigDto.STATUS_DESC)
  private Integer status;

  @Size(max = 255)
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.NAME_TITLE, description = Oauth2RegisteredClientAuthConfigDto.NAME_DESC)
  private String name;

  @Nullable
  @Size(max = 255)
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.REMARK_TITLE, description = Oauth2RegisteredClientAuthConfigDto.REMARK_DESC)
  private String remark;

  @LogicDelete
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.DELETE_FLAG_TITLE, description = Oauth2RegisteredClientAuthConfigDto.DELETE_FLAG_DESC)
  private Long deleteFlag;

  @CreatedDate
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.CREATE_TIME_TITLE, description = Oauth2RegisteredClientAuthConfigDto.CREATE_TIME_DESC)
  private Long createTime;

  @LastModifiedDate
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.UPDATE_TIME_TITLE, description = Oauth2RegisteredClientAuthConfigDto.UPDATE_TIME_DESC)
  private Long updateTime;

  @Version
  @Schema(title = Oauth2RegisteredClientAuthConfigDto.ROW_VERSION_TITLE, description = Oauth2RegisteredClientAuthConfigDto.ROW_VERSION_DESC)
  private Long rowVersion;

}
